# Contributor: Fabian Affolter <fabian@affolter-engineering.ch>
# Maintainer: Fabian Affolter <fabian@affolter-engineering.ch>
pkgname=py3-paramiko
_pkgname=paramiko
pkgver=2.7.1
pkgrel=0
pkgdesc="An SSH2 protocol library for Python3"
url="https://www.paramiko.org/"
arch="noarch"
license="LGPL-2.0-or-later"
options="!check" # missing pytest-relaxed module
depends="python3 py3-asn1 py3-cryptography py3-bcrypt py3-pynacl"
makedepends="py3-setuptools"
checkdepends="py3-mock py3-pytest"
subpackages="$pkgname-doc $pkgname-demos"
source="https://files.pythonhosted.org/packages/source/${_pkgname:0:1}/$_pkgname/$_pkgname-$pkgver.tar.gz"
builddir="$srcdir/$_pkgname-$pkgver"

replaces="py-paramiko" # Backwards compatibility
provides="py-paramiko=$pkgver-r$pkgrel" # Backwards compatibility

# secfixes:
#   2.4.2-r0:
#     - CVE-2018-1000805
#   2.4.1-r0:
#     - CVE-2018-7750

build() {
	python3 setup.py build
}

check() {
	python3 setup.py test
}

package() {
	python3 setup.py install --prefix=/usr --root="$pkgdir"
}

demos() {
	depends="$pkgname=$pkgver-r$pkgrel"
	pkgdesc="$pkgdesc (demos)"

	mkdir -p "$subpkgdir"/usr/share/doc/"$pkgname"/demos
	mv "$builddir"/demos "$subpkgdir"/usr/share/doc/"$pkgname"/
}

doc() {
	depends=""
	pkgdesc="$pkgdesc (documentation)"

	mkdir -p "$subpkgdir"/usr/share/doc/"$pkgname"/docs
	mv "$builddir"/docs "$subpkgdir"/usr/share/doc/"$pkgname"/
}

sha512sums="80068c8f72ab8c98d84188caa074deecead9fb459b1a71cedb3cfa627736730928a2b9c6eb2b5a8b60acb9bccb0f68aefbef9d0d55554001c835b5cf897751ab  paramiko-2.7.1.tar.gz"
